import java.util.Scanner;

public class GCD2 {
	private static int getGCD(int m, int n) {
		while(n != 0) {
			int r = m % n;
			m = n;
			n = r;
		}
		return m;
	}
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		String output;
		int m, n;
		
		while(sc.hasNext()) {
			m = sc.nextInt();
			n = sc.nextInt();
			
			if(m < n) {
				int temp = m;
				m = n;
				n = temp;
			}
			
			output = Integer.toString(getGCD(m, n));
			
			System.out.println(output);
		}
	}
}